<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import="com.etc.controller.*" %>
<%@page import="com.etc.entity.Announcement" %>
<%@page import="com.etc.dao.*" %>
<%@page import="java.util.*" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>公告发布-admin</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="Statics/css/font.css">
    <link rel="stylesheet" href="Statics/css/xadmin.css">
    <script src="Statics/js/jquery.min.js"></script>
    <script type="text/javascript" src="Statics/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="Statics/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <%
  String role=(String)session.getAttribute("userrole");
  %>
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <%
      if(role.equals("admin")){
      %>
        <a href="index_admin.jsp">首页</a>
        <%
      }
      else{
        %>
         <a href="index_user.jsp">首页</a>
         <%
      }
         %>
        <a href="">演示</a>
        <a>
          <cite>导航元素</cite></a>
      </span>
      <a class="layui-btn layui-btn-primary layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:38px">ဂ</i></a>
    </div>
    <div class="x-body">
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" id="searchForm" action="ListUserServlet" method="get")>
        <input type="hidden" name="pageIndex" value="<c:out value="${pageUser.pageIndex }"></c:out>">
     <%--  <input type="text" name="keywords"  id="userName" placeholder="请输入关键字" value="<c:out value="${searchName }"></c:out>" autocomplete="off" class="layui-input">
          <button onclick="searchBtn()" class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button> --%>
        </form>
      </div>
      <xblock>
        
        <button class="layui-btn" onclick="window.location.href='addannouncement.jsp';" ><i class="layui-icon" ></i>发布公告</button>
        
      </xblock>
      <table class="layui-table">
        <thead>
          <tr>
            <th>序号
              <!-- <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div> -->
            </th>
             <th>公告标题</th>
            <th>公共内容</th>
            <th>发布人</th>

        </thead>
        <tbody>
<%
List<Announcement> list= (List<Announcement>)request.getAttribute("AnnouncementList");
for(int i=0;i<list.size();i++){
	 request.setAttribute("gg", list.get(i)); 
%>
         
           <tr>
            <td>
            <%=i+1 %>
             <!--  <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='2'><i class="layui-icon">&#xe605;</i></div> -->
            </td>
             <td>${gg.title }</td>
            <td>${gg.content }</td>
            <td>${gg.username }</td>
            <td class="td-manage">
              <a title="编辑"  href="modifyannouncement.jsp?uid=<c:out value="${gg.id}"></c:out>" >
                <i class="layui-icon">&#xe642;</i>
              </a>
              <a title="删除"  href="DeleteAnnouncementServlet?uid=<c:out value="${gg.id}"></c:out>">
                <i class="layui-icon">&#xe640;</i>
              </a>
            </td>
          </tr>
          <%
}
          %>
        </tbody>
      </table>
<%--      <div class="page">
        <div>

        <c:if test="${pageUser.pageIndex > 1 }">
            <a class="prev numPage" href="ListUserServlet?pageIndex=1&userName=<c:out value="${searchName }"></c:out>">首页</a>
            <a class="prev numPage" href="ListUserServlet?pageIndex=<c:out value="${pageUser.pageIndex-1 }"></c:out>&userName=<c:out value="${searchName }"></c:out>">上一页</a>
     </c:if>
        <c:if test="${pageUser.pageIndex<pageUser.totalPage }">
          <a class="nex numPage" href="ListUserServlet?pageIndex=<c:out value="${pageUser.pageIndex+1 }"></c:out>&userName=<c:out value="${searchName }"></c:out>">下一页</a>
        </c:if> 
          <a>当前是第 <c:out value="${pageUser.pageIndex }"></c:out>页</a>
          <c:if test="${pageUser.pageIndex!=pageUser.totalPage }">
          <a class="prev numPage" href="ListUserServlet?pageIndex=<c:out value="${pageUser.totalPage }"></c:out>&userName=<c:out value="${searchName }"></c:out>">末页</a>
          </c:if>
        </div>
      </div>  --%>

    </div>
   
  </body>

</html>